from flask import request, redirect, url_for
from app import app, db
from app.models.user import User

# 测试用
@app.route('/add_user', methods=['POST'])
def add_user():
    name = request.form['name']
    userid = request.form['userid']
    user = User(name=name, userid=userid)
    db.session.add(user)
    db.session.commit()
    # return redirect(url_for('users'))
    return f"接收到的 userid 是：{userid}，name 是：{name}"
